package com.finance.system.dao;

import com.finance.framework.lang.Page;
import com.finance.system.bean.pojo.Menu;
import com.finance.system.bean.pojo.Role;
import com.finance.system.bean.pojo.RoleMenuRel;
import com.finance.system.bean.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * Created by CBWL on 2017/3/17.
 */
@Component
public interface RoleMapper {
    Role getById(String id);
    List<Role> listByPage(Page page);
    List<Role> getByUserCode(String code);
    List<Role> listRoles();
    int add(Role role);
    int delete(String id);
    int update(@Param("role") Role role);
    List<Menu> listMenus(Role role);
    int add4User(@Param("user") User user, @Param("authUser") User authUser, @Param("role") Role role);
    int update4User(@Param("user") User user, @Param("authUser") User authUser, @Param("role") Role role);
    int batchDelRole(List<String> id);
    int delByRoleId(Long roleId);
    List<Role> listAll();
    int batchAddMenuRel(@Param("roleMenuRelList") List<RoleMenuRel> roleMenuRelList);
    List<RoleMenuRel> listByRoleId(@Param("roleId") Long roleId);
    int batchInvalid(@Param("uId")Long uId,@Param("invalidRels")List<RoleMenuRel> invalidRels);
    int batchValid(@Param("uId")Long uId,@Param("validRels")List<RoleMenuRel> validRels);
    List<Map<String,Object>> getByRoleId(Long roleId);
    Role queryById(@Param("roleId") Long roleId);

    List<Map<String,Object>> getRoleById(Long id);
}
